package books.ThinkingInJava.src.Chapter12;

import books.ThinkingInJava.src.Tools.Output;

import java.io.IOException;

public class TestExceptionStructure {
    public TestExceptionStructure(Exception e) {
        e.printStackTrace();
    }

    public TestExceptionStructure() {
        try {
            a a = new b();
        } catch (Exception e) {
            Output.println("In init");
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        try {
            TestExceptionStructure tes = new TestExceptionStructure();
        } catch (Exception e) {
            Output.println("In main");
            e.printStackTrace();
        }
    }

    class a {
        public a() throws IOException {
            Output.println("In a");
            throw new IOException();
        }
    }

    class b extends a {
        public b() throws Exception {
            super();
            try {
            } catch (Exception e) {
                Output.println("In b");
                e.printStackTrace();
            }
        }
    }
}
